#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int space_count_for_tab = argc > 1 ? atoi(argv[1]) : 4; // get the number of spaces to replace a tab with
    char c;
    while ((c = getchar()) != EOF) // read a character at a time
    {
        if (c == '\t') // if the character is a tab, replace it with the number of spaces specified
        {
            for (int i = 0; i < space_count_for_tab; i++) // loop through the number of spaces specified
            {
                putchar(' '); // print the number of spaces specified
            }
        }
        else
        {
            putchar(c); // print the character
        }
    }

    return 0;
}
